<template>
  <div>
    <div class="search">
      <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <el-form-item label="">
          <el-input v-model="formInline.admin" placeholder="请输入查找管理员"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">查找</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="table">
      <template>
        <el-table :data="tableData" border style="width: 100%" highlight-current-row>
          <el-table-column prop="admin" label="操作管理员" width="152">
          </el-table-column>
          <el-table-column prop="ip" label="IP地址" width="152">
          </el-table-column>
          <el-table-column prop="updateTime" label="操作时间" width="152">
          </el-table-column>
          <el-table-column prop="type" label="操作类别" width="152">
            <template slot-scope="scope">
              <span>{{ scope.row.type === 1? '安全操作' : scope.row.type === 2? '订单操作' : '' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="action" label="操作动作" width="152">
          </el-table-column>
          <el-table-column prop="status" label="操作状态" width="152">
            <template slot-scope="scope">
              <span>{{ scope.row.status === true? '成功' : scope.row.status === false? '失败' : '' }}</span>
            </template>
          </el-table-column>
          <el-table-column prop="result" label="操作结果" width="152">
            
          </el-table-column>
          <el-table-column prop="comment" label="备注信息" width="152">
          </el-table-column>
        </el-table>
      </template>
    </div>
    <div class="block">
    
    <el-pagination
    background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage4"
      :page-sizes="[5, 10, 15, 20]"
      :page-size=Number(this.pageSize)
      layout="total, sizes, prev, pager, next, jumper"
      :total=Number(this.total)>
    </el-pagination>
  </div>
  </div>
</template>

<script>
import { yonghu } from '@/api/xtgl/czrz.js';
export default {
  name: 'DocumentsLog',

  data() {
    return {
      pageSize: '20',
      total: '',
      currentPage4: 1,
      tableData:[],
      formInline: {
        admin: '',
        // region: ''
      }
    };
  },

  mounted() {
    this.show()
  },

  methods: {
    handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
        this.pageSize=val
        this.show()
      },
      handleCurrentChange(val) {
        console.log(`当前页: ${val}`);
        this.currentPage4=val
        this.show()
      },
    show(){
      yonghu({
        page:this.currentPage4,
        limit:this.pageSize,
        sort:'add_time',
        order:'desc'
      }).then((res)=>{
        console.log(res);
        this.tableData = res.data.list
        this.total = res.data.total
      })
    },
    onSubmit() {
      yonghu({
        page:1,
        limit:this.pageSize,
        sort:'add_time',
        order:'desc',
        name:this.formInline.admin
      }).then((res)=>{
        console.log(res);
        this.tableData = res.data.list
        this.total = res.data.total
        
      })
    }
  },
};
</script>
<style scoped>
::v-deep .cell{
  text-align: center;
}
</style>